package com.black.utils.office.excel;

import com.alibaba.fastjson2.JSONArray;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

/**
 * excel实体
 * &#064;date  2024-08-23
 * @author ylx
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ExcelEntity {
    /**
     * sheet名称
     */
    private String sheetName;
    /**
     * 表头
     */
    private List<ExcelHeader> headers;
    /**
     * 数据
     */
    private JSONArray data;
    /**
     * 合并单元格 仅支持xls xlsx 格式  csv html 暂不支持
     */
    private List<int[]> mergeCells = new ArrayList<>();

    public ExcelEntity(List<ExcelHeader> headers, JSONArray data) {
        this(null, headers, data);
    }

    public ExcelEntity(String sheetName, List<ExcelHeader> headers, JSONArray data) {
        this.sheetName = sheetName;
        this.headers = headers;
        this.data = data;
    }

    public void addMergeCell(int[] cell) {
        this.mergeCells.add(cell);
    }
}
